<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>ES入门 - 分析器 | java知识体系</title>
    <meta name="generator" content="VuePress 1.9.7">
    <link rel="icon" href="/lm_blog_vdoing/img/favicon.ico">
    <meta name="description" content="lm_blog">
    <meta name="author" content="小猫爱吃鱼">
    <meta name="keywords" content="小猫爱吃鱼|java开发学习">
    <link rel="preload" href="/lm_blog_vdoing/assets/css/0.styles.6837ef6d.css" as="style"><link rel="preload" href="/lm_blog_vdoing/assets/js/app.fa0e5fdd.js" as="script"><link rel="preload" href="/lm_blog_vdoing/assets/js/2.d9c93b35.js" as="script"><link rel="preload" href="/lm_blog_vdoing/assets/js/22.9937ce9d.js" as="script"><link rel="preload" href="/lm_blog_vdoing/assets/js/5.e0bc0396.js" as="script"><link rel="preload" href="/lm_blog_vdoing/assets/js/13.ee87d1ca.js" as="script"><link rel="preload" href="/lm_blog_vdoing/assets/js/14.9d4d9cf6.js" as="script"><link rel="preload" href="/lm_blog_vdoing/assets/js/9.fc3a629f.js" as="script"><link rel="preload" href="/lm_blog_vdoing/assets/js/10.4c34cde9.js" as="script"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/11.bccd7768.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/12.e841fec0.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/15.ea506303.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/16.2da770e9.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/17.2e0242dc.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/18.304c9e7d.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/19.4b93faf0.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/20.87daf9d0.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/21.058f688b.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/23.87e8eccb.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/24.1688627c.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/25.04906008.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/26.494f706b.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/27.01c810da.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/28.9fbe8e29.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/29.3a1e938a.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/3.80bae7d2.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/30.4adb3ea1.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/31.5001aed0.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/32.306c6420.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/33.5fcce29f.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/34.2de40b8f.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/4.d2df651a.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/6.cbc45c4c.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/7.fd589d8e.js"><link rel="prefetch" href="/lm_blog_vdoing/assets/js/8.35156f8e.js">
    <link rel="stylesheet" href="/lm_blog_vdoing/assets/css/0.styles.6837ef6d.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/lm_blog_vdoing/" class="home-link router-link-active"><!----> <span class="site-name">java知识体系</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/lm_blog_vdoing/" class="nav-link">首页​</a></div><div class="nav-item"><a href="/lm_blog_vdoing/pages/f6054a/" class="nav-link">❁导航​</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机核心" class="dropdown-title"><!----> <span class="title" style="display:;">计算机核心</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/db72cf/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/39e2a1/" class="nav-link">计算机网络</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Java" class="dropdown-title"><!----> <span class="title" style="display:;">Java</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>Java基础</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e05ef5/" class="nav-link">JavaSE</a></li></ul></li><li class="dropdown-item"><h4>JavaWeb</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/5cda88/" class="nav-link">HTML</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/cea341/" class="nav-link">CSS</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/d893c0/" class="nav-link">JavaScript</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/8f83ba/" class="nav-link">Servlet</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/8bc1c4/" class="nav-link">MVC</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/f883e2/" class="nav-link">filter|listener</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Spring生态" class="dropdown-title"><!----> <span class="title" style="display:;">Spring生态</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/462a90/" class="nav-link">Spring5</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/2e990c/" class="nav-link">SpringMVC</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/0d4af0/" class="nav-link">SpringBoot2</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/870083/" class="nav-link">SpringCloud</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/66babb/" class="nav-link">SpringSecurity</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="中间件" class="dropdown-title"><!----> <span class="title" style="display:;">中间件</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>消息队列</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e645d9/" class="nav-link">RabbitMQ</a></li></ul></li><li class="dropdown-item"><h4>服务器</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/9551ee/" class="nav-link">Nginx🌐</a></li></ul></li><li class="dropdown-item"><h4>服务框架</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/48771f/" class="nav-link">Dubbo</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="大数据" class="dropdown-title"><!----> <span class="title" style="display:;">大数据</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>Python</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/b9268d/" class="nav-link">Python基础</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e0bd06/" class="nav-link">数据分析</a></li></ul></li><li class="dropdown-item"><h4>环境搭建</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/600247/" class="nav-link">Hadoop集群</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/cdeb68/" class="nav-link">KVM虚拟化技术</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>SQL 数据库</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e72480/" class="nav-link">MySQL</a></li></ul></li><li class="dropdown-item"><h4>NoSQL 数据库</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e9cc9f/" class="nav-link">Redis</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/91197c/" class="nav-link">MongoDB</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/7b46ed/" class="nav-link">ElasticSearch</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="工具" class="dropdown-title"><!----> <span class="title" style="display:;">工具</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>部署</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/99e9dc/" class="nav-link">Linux</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/90cc29/" class="nav-link">Docker</a></li></ul></li><li class="dropdown-item"><h4>管理</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/45eca1/" class="nav-link">Maven</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/34892c/" class="nav-link">Git</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面试" class="dropdown-title"><!----> <span class="title" style="display:;">面试</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/eab19d/" class="nav-link">十大排序算法</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/40ee62/" class="nav-link">力扣算法题</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/39558d/" class="nav-link">初级开发篇</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/47c622/" class="nav-link">中高进阶篇</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="更多" class="dropdown-title"><!----> <span class="title" style="display:;">更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/myfriends/" class="nav-link">友情链接</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="本站" class="dropdown-title"><!----> <span class="title" style="display:;">本站</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>索引</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/categories/" class="nav-link">分类</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/tags/" class="nav-link">标签</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/archives/" class="nav-link">归档</a></li></ul></li><li class="dropdown-item"><h4>其他</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/9013e4/" class="nav-link">关于</a></li></ul></li></ul></div></div> <a href="https://gitee.com/lmgghub/lm_blog" target="_blank" rel="noopener noreferrer" class="repo-link">
    查看源码
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><div class="blogger"><img src="https://cdn.staticaly.com/gh/xustudyxu/image-hosting@master/20220627/mmexport1656324824543.124zxwkqyzlc.webp"> <div class="blogger-info"><h3>lm_blog</h3> <span>持续学习!</span></div></div> <nav class="nav-links"><div class="nav-item"><a href="/lm_blog_vdoing/" class="nav-link">首页​</a></div><div class="nav-item"><a href="/lm_blog_vdoing/pages/f6054a/" class="nav-link">❁导航​</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机核心" class="dropdown-title"><!----> <span class="title" style="display:;">计算机核心</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/db72cf/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/39e2a1/" class="nav-link">计算机网络</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Java" class="dropdown-title"><!----> <span class="title" style="display:;">Java</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>Java基础</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e05ef5/" class="nav-link">JavaSE</a></li></ul></li><li class="dropdown-item"><h4>JavaWeb</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/5cda88/" class="nav-link">HTML</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/cea341/" class="nav-link">CSS</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/d893c0/" class="nav-link">JavaScript</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/8f83ba/" class="nav-link">Servlet</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/8bc1c4/" class="nav-link">MVC</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/f883e2/" class="nav-link">filter|listener</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="Spring生态" class="dropdown-title"><!----> <span class="title" style="display:;">Spring生态</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/462a90/" class="nav-link">Spring5</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/2e990c/" class="nav-link">SpringMVC</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/0d4af0/" class="nav-link">SpringBoot2</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/870083/" class="nav-link">SpringCloud</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/66babb/" class="nav-link">SpringSecurity</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="中间件" class="dropdown-title"><!----> <span class="title" style="display:;">中间件</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>消息队列</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e645d9/" class="nav-link">RabbitMQ</a></li></ul></li><li class="dropdown-item"><h4>服务器</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/9551ee/" class="nav-link">Nginx🌐</a></li></ul></li><li class="dropdown-item"><h4>服务框架</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/48771f/" class="nav-link">Dubbo</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="大数据" class="dropdown-title"><!----> <span class="title" style="display:;">大数据</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>Python</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/b9268d/" class="nav-link">Python基础</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e0bd06/" class="nav-link">数据分析</a></li></ul></li><li class="dropdown-item"><h4>环境搭建</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/600247/" class="nav-link">Hadoop集群</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/cdeb68/" class="nav-link">KVM虚拟化技术</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>SQL 数据库</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e72480/" class="nav-link">MySQL</a></li></ul></li><li class="dropdown-item"><h4>NoSQL 数据库</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/e9cc9f/" class="nav-link">Redis</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/91197c/" class="nav-link">MongoDB</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/7b46ed/" class="nav-link">ElasticSearch</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="工具" class="dropdown-title"><!----> <span class="title" style="display:;">工具</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>部署</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/99e9dc/" class="nav-link">Linux</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/90cc29/" class="nav-link">Docker</a></li></ul></li><li class="dropdown-item"><h4>管理</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/45eca1/" class="nav-link">Maven</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/34892c/" class="nav-link">Git</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面试" class="dropdown-title"><!----> <span class="title" style="display:;">面试</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/eab19d/" class="nav-link">十大排序算法</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/40ee62/" class="nav-link">力扣算法题</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/39558d/" class="nav-link">初级开发篇</a></li><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/47c622/" class="nav-link">中高进阶篇</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="更多" class="dropdown-title"><!----> <span class="title" style="display:;">更多</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/lm_blog_vdoing/pages/myfriends/" class="nav-link">友情链接</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="本站" class="dropdown-title"><!----> <span class="title" style="display:;">本站</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><h4>索引</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/categories/" class="nav-link">分类</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/tags/" class="nav-link">标签</a></li><li class="dropdown-subitem"><a href="/lm_blog_vdoing/archives/" class="nav-link">归档</a></li></ul></li><li class="dropdown-item"><h4>其他</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/lm_blog_vdoing/pages/9013e4/" class="nav-link">关于</a></li></ul></li></ul></div></div> <a href="https://gitee.com/lmgghub/lm_blog" target="_blank" rel="noopener noreferrer" class="repo-link">
    查看源码
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>MySQL - 基础</span> <!----></p> <!----></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>MySQL - 进阶</span> <!----></p> <!----></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>MySQL - 运维部署</span> <!----></p> <!----></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>NoSQL - Redis</span> <!----></p> <!----></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>NoSQL - MongoDB</span> <!----></p> <!----></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>NoSQL - ElasticSearch</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/lm_blog_vdoing/pages/7b46ed/" class="sidebar-link">ElasticeSarch的概述</a></li><li><a href="/lm_blog_vdoing/pages/596552/" class="sidebar-link">ES入门 - 环境安装</a></li><li><a href="/lm_blog_vdoing/pages/bc6018/" class="sidebar-link">ES入门 - 基本使用：索引和文档</a></li><li><a href="/lm_blog_vdoing/pages/6e6e0c/" class="sidebar-link">ES入门 - 分片和副本</a></li><li><a href="/lm_blog_vdoing/pages/3d97b1/" aria-current="page" class="active sidebar-link">ES入门 - 分析器</a></li><li><a href="/lm_blog_vdoing/pages/b54e3a/" class="sidebar-link">ES入门 - java整合</a></li><li><a href="/lm_blog_vdoing/pages/7e4dff/" class="sidebar-link">ES进阶 - 分片操作原理</a></li><li><a href="/lm_blog_vdoing/pages/b82771/" class="sidebar-link">ES进阶 - 并发问题</a></li><li><a href="/lm_blog_vdoing/pages/c3becc/" class="sidebar-link">ES进阶 - 集群搭建</a></li><li><a href="/lm_blog_vdoing/pages/6d9622/" class="sidebar-link">ES进阶 - 优化配置</a></li><li><a href="/lm_blog_vdoing/pages/da009f/" class="sidebar-link">ES进阶 - 框架整合</a></li><li><a href="/lm_blog_vdoing/pages/7cb809/" class="sidebar-link">ElasticSearch面试题</a></li></ul></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-1baff76c><div class="articleInfo" data-v-1baff76c><ul class="breadcrumbs" data-v-1baff76c><li data-v-1baff76c><a href="/lm_blog_vdoing/" title="首页" class="iconfont icon-home router-link-active" data-v-1baff76c></a></li> <li data-v-1baff76c><a href="/lm_blog_vdoing/categories/?category=notes" title="分类" data-v-1baff76c>notes</a></li><li data-v-1baff76c><a href="/lm_blog_vdoing/categories/?category=database" title="分类" data-v-1baff76c>database</a></li><li data-v-1baff76c><a href="/lm_blog_vdoing/categories/?category=elasticSearch" title="分类" data-v-1baff76c>elasticSearch</a></li></ul> <div class="info" data-v-1baff76c><div title="作者" class="author iconfont icon-touxiang" data-v-1baff76c><a href="javascript:;" data-v-1baff76c>lm</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-1baff76c><a href="javascript:;" data-v-1baff76c>2023-02-20</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">ES入门 - 分析器<!----></h1> <!----> <div class="theme-vdoing-content content__default"><h1 id="elasticsearch入门-分析器"><a href="#elasticsearch入门-分析器" class="header-anchor">#</a> ElasticSearch入门 - 分析器</h1> <h2 id="分析原理"><a href="#分析原理" class="header-anchor">#</a> 分析原理</h2> <p>分析包含下面的过程：</p> <ul><li>将一块文本分成适合于倒排索引的独立的「词条」</li> <li>将这些词条统一化为标准格式以提高它们的「可搜索性」，或者 recall</li></ul> <p>分析器执行上面的工作。分析器实际上是将三个功能封装到了一个包里：</p> <ul><li><strong>字符过滤器</strong>：首先，字符串按顺序通过每个字符过滤器。他们的任务是在分词前整理字符串。一个字符过滤器可以用来去掉 HTML，或者将 &amp; 转化成 and</li> <li><strong>分词器</strong>：其次，字符串被分词器分为单个的词条。一个简单的分词器遇到空格和标点的时候，可能会将文本拆分成词条</li> <li><strong>Token 过滤器</strong>：最后，词条按顺序通过每个 token 过滤器。这个过程可能会改变词条（例如，小写化 Quick ），删除词条（例如，像 a，and，the 等无用词），或者增加词条（例如，像 jump 和 leap 这种同义词）</li></ul> <h2 id="内置分析器"><a href="#内置分析器" class="header-anchor">#</a> 内置分析器</h2> <p>ElasticSearch 还附带了可以直接使用的预包装的分析器。接下来我们会列出最重要的分析器。为了证明它们的差异，我们看看每个分析器会从下面的字符串得到哪些词条，先给出词条例子：</p> <p>Set the shape to semi-transparent by calling set_trans(5)</p> <h3 id="标准分析器"><a href="#标准分析器" class="header-anchor">#</a> 标准分析器</h3> <p>标准分析器是 ElasticSearch 默认使用的分析器。它是分析各种语言文本最常用的选择。它根据 Unicode 联盟定义的单词边界、划分文本。删除绝大部分标点。最后，将词条小写。它会解析词条产生：</p> <p>set, the, shape, to, semi, transparent, by, calling, set_trans, 5</p> <h3 id="简单分析器"><a href="#简单分析器" class="header-anchor">#</a> 简单分析器</h3> <p>简单分析器在任何不是字母的地方分隔文本，将词条小写。它会解析词条产生：</p> <p>set, the, shape, to, semi, transparent, by, calling, set, trans</p> <h3 id="空格分析器"><a href="#空格分析器" class="header-anchor">#</a> 空格分析器</h3> <p>空格分析器在空格的地方划分文本。它会解析词条产生：</p> <p>Set, the, shape, to, semi-transparent, by, calling, set_trans(5)</p> <h3 id="语言分析器"><a href="#语言分析器" class="header-anchor">#</a> 语言分析器</h3> <p>特定语言分析器可用于很多语言。它们可以考虑指定语言的特点。例如，「英语分析器」去掉一组英语无用词（常用单词，例如 and、the、to、by，因为它们对相关性没有多少影响），它们会被删除。由于理解英语语法的规则，这个分词器可以提取英语单词的词干。</p> <p><strong>英语分词器</strong>会产生下面的词条：</p> <p>set, shape, semi, transpar, call, set_tran, 5</p> <p>注意看 transparent、 calling 和 set_trans 已经变为词根格式</p> <h2 id="分析器使用场景"><a href="#分析器使用场景" class="header-anchor">#</a> 分析器使用场景</h2> <p>当我们「检索」一个文档，它的全文域被分析成词条以用来创建倒排索引。但是，当我们在全文域搜索的时候，我们需要将查询字符串通过相同的分析过程，以保证我们搜索的词条格式与索引中的词条格式一致。</p> <p>全文查询，理解每个域是如何定义的，因此它们可以做正确的事：</p> <ul><li>当你查询一个「全文域」时，会对查询字符串应用相同的分析器，以产生正确的搜索词条列表</li> <li>当你查询一个「精确值域」时，不会分析查询字符串，而是搜索你指定的精确值</li></ul> <h2 id="测试分析器"><a href="#测试分析器" class="header-anchor">#</a> 测试分析器</h2> <p>有些时候很难理解分词的过程和实际被存储到索引中的词条，特别是你刚接触 ElasticSearch。为了理解发生了什么，你可以使用 analyze API 来看文本是如何被分析的。</p> <p>在请求体里，指定分析器和要分析的文本：</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code>GET http<span class="token operator">:</span><span class="token comment">//localhost:9200/_analyze</span>
<span class="token punctuation">{</span>
    <span class="token property">&quot;analyzer&quot;</span><span class="token operator">:</span> <span class="token string">&quot;standard&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;text&quot;</span><span class="token operator">:</span> <span class="token string">&quot;my name is lm&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p>返回结果中每个元素代表一个单独的词条：</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;tokens&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;my&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;name&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">7</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;is&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">8</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">10</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">2</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;lm&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">13</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">3</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div><p>token 是实际存储到索引中的词条，也就是分析器分析后的结果。position 指明词条在原始文本中出现的位置。start_offset 和 end_offset 指明字符在原始字符串中的位置。</p> <h2 id="指定分析器"><a href="#指定分析器" class="header-anchor">#</a> 指定分析器</h2> <p>当 ElasticSearch 在文档中检测到一个新的字符串域，它会自动设置其为一个「全文字符串域」，并使用「标准分析器」对它进行分析。但是你不希望总是这样。可能你想使用一个不同的分析器，适用于你的数据使用的语言。有时候你想要一个字符串域就是一个字符串域，即不需要进行分析，直接检索你传入的精确值，例如用户 ID 或者一个内部的状态域或标签。要做到这一点，我们必须手动指定这些域的映射。</p> <h3 id="ik分词器"><a href="#ik分词器" class="header-anchor">#</a> IK分词器</h3> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;text&quot;</span><span class="token operator">:</span><span class="token string">&quot;新春快乐&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>ES 的默认分词器无法识别中文中测试、单词这样的词汇，而是简单的将每个字拆完分为一个词，看返回结果：</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;tokens&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;新&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;IDEOGRAPHIC&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;春&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;IDEOGRAPHIC&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;快&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;IDEOGRAPHIC&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">2</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;乐&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">3</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;IDEOGRAPHIC&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">3</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div><p>token 是实际存储到索引中的词条，也就是分析器分析后的结果。position 指明词条在原始文本中出现的位置。start_offset 和 end_offset 指明字符在原始字符串中的位置。</p> <p>这样的结果显然不符合我们的使用要求，所以我们需要下载 ES 对应版本的中文分词器</p> <p><a href="https://github.com/medcl/elasticsearch-analysis-ik/releases/" target="_blank" rel="noopener noreferrer">IK中文分词器下载地址<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>下载的版本和自己的 ES 版本保持一致，否则会出现兼容性问题。</p> <p>下载后，进行解压，并将解压后的后的文件夹放入 ES 根目录下的 plugins 目录下，重启 ES 即可使用。</p> <blockquote><p>安装路径不能有空格，如 Program area 中间有空格导致无法启动或者无法查询出数据。</p></blockquote> <p>这次加入新的查询参数：&quot;analyzer&quot;: &quot;ik_max_word&quot;</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;text&quot;</span><span class="token operator">:</span> <span class="token string">&quot;新春快乐&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;analyzer&quot;</span><span class="token operator">:</span> <span class="token string">&quot;ik_max_word&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><ul><li>ik_max_word：会将文本做最细粒度的拆分</li> <li>ik_smart：会将文本做最粗粒度的拆分</li></ul> <p>使用中文分词后的结果为：</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;tokens&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;新春快乐&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_WORD&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;新春&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_WORD&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;快乐&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_WORD&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">2</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><p>token 是实际存储到索引中的词条，也就是分析器分析后的结果。position 指明词条在原始文本中出现的位置。start_offset 和 end_offset 指明字符在原始字符串中的位置。</p> <p>ES 中也可以进行扩展词汇，首先查询</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;text&quot;</span><span class="token operator">:</span><span class="token string">&quot;德玛西亚&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;analyzer&quot;</span><span class="token operator">:</span><span class="token string">&quot;ik_max_word&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p>分词结果跟我们想象有点差异</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;tokens&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;德&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_CHAR&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;玛&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">1</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_CHAR&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;西亚&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_WORD&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">2</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br></div></div><p>我们需要做的就是使分词器识别到「德玛西亚」也是一个词语</p> <p>首先进入 ES 根目录中的 plugins 文件夹下的 ik 文件夹，进入 config 目录，创建 custom.dic 文件，写入德玛西亚。同时打开 IKAnalyzer.cfg.xml 文件，将新建的 custom.dic 配置其中，重启 ES 服务器。</p> <div class="language-xml line-numbers-mode"><pre class="language-xml"><code><span class="token prolog">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span class="token doctype"><span class="token punctuation">&lt;!</span><span class="token doctype-tag">DOCTYPE</span> <span class="token name">properties</span> <span class="token name">SYSTEM</span> <span class="token string">&quot;http://java.sun.com/dtd/properties.dtd&quot;</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>properties</span><span class="token punctuation">&gt;</span></span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>comment</span><span class="token punctuation">&gt;</span></span>IK Analyzer 扩展配置<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>comment</span><span class="token punctuation">&gt;</span></span>
	<span class="token comment">&lt;!--用户可以在这里配置自己的扩展字典 --&gt;</span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>entry</span> <span class="token attr-name">key</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>ext_dict<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>custom.dic<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>entry</span><span class="token punctuation">&gt;</span></span>
	 <span class="token comment">&lt;!--用户可以在这里配置自己的扩展停止词字典--&gt;</span>
	<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>entry</span> <span class="token attr-name">key</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>ext_stopwords<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>entry</span><span class="token punctuation">&gt;</span></span>
	<span class="token comment">&lt;!--用户可以在这里配置远程扩展字典 --&gt;</span>
	<span class="token comment">&lt;!-- &lt;entry key=&quot;remote_ext_dict&quot;&gt;words_location&lt;/entry&gt; --&gt;</span>
	<span class="token comment">&lt;!--用户可以在这里配置远程扩展停止词字典--&gt;</span>
	<span class="token comment">&lt;!-- &lt;entry key=&quot;remote_ext_stopwords&quot;&gt;words_location&lt;/entry&gt; --&gt;</span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>properties</span><span class="token punctuation">&gt;</span></span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br></div></div><p>返回结果</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;tokens&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;德玛西亚&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">0</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_WORD&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">0</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;西亚&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">2</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;CN_WORD&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br></div></div><h2 id="自定义分析器"><a href="#自定义分析器" class="header-anchor">#</a> 自定义分析器</h2> <p>虽然 ElasticSearch 带有一些现成的分析器，然而在分析器上 ElasticSearch 真正的强大之处在于，你可以通过在一个适合你的特定数据的设置之中组合字符过滤器、分词器、词汇单元过滤器来创建自定义的分析器。一个分析器就是在一个包里面组合了三种函数的一个包装器，三种函数按照顺序被执行：</p> <h3 id="字符过滤器"><a href="#字符过滤器" class="header-anchor">#</a> 字符过滤器</h3> <p>字符过滤器用来整理一个尚未被分词的字符串。例如，如果我们的文本是 HTML 格式的，它会包含像</p> <p>或者</p> <p>这样的 HTML 标签，这些标签是我们不想检索的。我们可以使用 HTML 「清除字符过滤器」来移除掉所有的 HTML 标签，并且像把 Á 转换为相对应的 Unicode 字符 Á 这样，转换 HTML 实体。一个分析器可能有 0 个或者多个字符过滤器。</p> <h3 id="分词器"><a href="#分词器" class="header-anchor">#</a> 分词器</h3> <p>一个分析器必须有一个唯一的分词器。分词器把字符串分解成单个词条或者词汇单元。「标准分析器」里使用的是把一个字符串根据单词边界分解成单个词条，并且移除掉大部分的标点符号，然而还有其他不同行为的分词器存在。例如，「关键词分词器」完整地输出接收到的同样的字符串，并不做任何分词。「空格分词 器」只根据空格分割文本。「正则分词器」根据匹配正则表达式来分割文本。</p> <h3 id="词单元过滤器"><a href="#词单元过滤器" class="header-anchor">#</a> 词单元过滤器</h3> <p>经过分词，作为结果的「词单元流」会按照指定的顺序通过指定的词单元过滤器。「词单元过滤器」可以修改、添加或者移除词单元。我们已经提到过 lowercase 和 stop 词过滤器 ，但是在 ElasticSearch 里面还有很多可供选择的词单元过滤器。「词干过滤器」把单词遏制为词干。「ascii_folding 过滤器」移除变音符，把一个像 &quot;très&quot; 这样的词转换为 &quot;tres&quot;。</p> <p>「ngram 和 edge_ngram 词单元过滤器」可以产生适合用于部分匹配或者自动补全的词单元。</p> <h3 id="自定义分析器案例"><a href="#自定义分析器案例" class="header-anchor">#</a> 自定义分析器案例</h3> <p>接下来，我们看看如何创建自定义的分析器：</p> <p>发送PUT请求: http://localhost:9200/my_index</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;settings&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>
        <span class="token property">&quot;analysis&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token comment">// 开启自定义分析器</span>
            <span class="token property">&quot;char_filter&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>  <span class="token comment">// 自定义分词器名</span>
                <span class="token property">&quot;&amp;_to_and&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>  <span class="token comment">// 自定义名字，尽量和分析内容有关</span>
                    <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;mapping&quot;</span><span class="token punctuation">,</span>  <span class="token comment">// 转换类型</span>
                    <span class="token property">&quot;mappings&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span> <span class="token string">&quot;&amp;=&gt; and &quot;</span><span class="token punctuation">]</span>  <span class="token comment">// 将 &amp; 转换为 and</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token property">&quot;filter&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span> <span class="token comment">// 自定义分词器名</span>
                <span class="token property">&quot;my_stopwords&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>  <span class="token comment">// 自定义名字，尽量和分析内容有关</span>
                    <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;stop&quot;</span><span class="token punctuation">,</span>  <span class="token comment">// 删除类型</span>
                    <span class="token property">&quot;stopwords&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span> <span class="token string">&quot;the&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;a&quot;</span> <span class="token punctuation">]</span> <span class="token comment">// 把 the 和 a 删除</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">}</span><span class="token punctuation">,</span>
            <span class="token property">&quot;analyzer&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>   <span class="token comment">// 实现已经做好的自定义分词器</span>
                <span class="token property">&quot;my_analyzer&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span>  <span class="token comment">// 自定义名字</span>
                    <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;custom&quot;</span><span class="token punctuation">,</span>  <span class="token comment">// 代表 自定义 类型</span>
                    <span class="token property">&quot;char_filter&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span> <span class="token string">&quot;html_strip&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;&amp;_to_and&quot;</span> <span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token comment">// 上面做好的自定义分词器添加进来</span>
                    <span class="token property">&quot;tokenizer&quot;</span><span class="token operator">:</span> <span class="token string">&quot;standard&quot;</span><span class="token punctuation">,</span> <span class="token comment">// 隶属于标准分词器</span>
                    <span class="token property">&quot;filter&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span> <span class="token string">&quot;lowercase&quot;</span><span class="token punctuation">,</span> <span class="token string">&quot;my_stopwords&quot;</span> <span class="token punctuation">]</span> <span class="token comment">// 上面做好的自定义分词器添加进来</span>
                <span class="token punctuation">}</span>
            <span class="token punctuation">}</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br></div></div><p>索引被创建以后，</p> <p>发送<code>GET</code>请求，使用 <code>analyze API</code> 来测试这个新的分析器</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;text&quot;</span><span class="token operator">:</span><span class="token string">&quot;The quick &amp; brown fox&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;analyzer&quot;</span><span class="token operator">:</span> <span class="token string">&quot;my_analyzer&quot;</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br></div></div><p><img alt="image" data-src="https://cdn.staticaly.com/gh/xustudyxu/image-hosting1@master/20220706/image.3t129jxdbbe0.webp" loading="lazy" class="lazy"></p> <p>下面的缩略结果展示出分析器正在正确地运行：</p> <div class="language-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;tokens&quot;</span><span class="token operator">:</span> <span class="token punctuation">[</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;quick&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">4</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">9</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">1</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;and&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">10</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">11</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">2</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;brown&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">12</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">17</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">3</span>
        <span class="token punctuation">}</span><span class="token punctuation">,</span>
        <span class="token punctuation">{</span>
            <span class="token property">&quot;token&quot;</span><span class="token operator">:</span> <span class="token string">&quot;fox&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;start_offset&quot;</span><span class="token operator">:</span> <span class="token number">18</span><span class="token punctuation">,</span>
            <span class="token property">&quot;end_offset&quot;</span><span class="token operator">:</span> <span class="token number">21</span><span class="token punctuation">,</span>
            <span class="token property">&quot;type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;&lt;ALPHANUM&gt;&quot;</span><span class="token punctuation">,</span>
            <span class="token property">&quot;position&quot;</span><span class="token operator">:</span> <span class="token number">4</span>
        <span class="token punctuation">}</span>
    <span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br></div></div><h2 id="参考文章"><a href="#参考文章" class="header-anchor">#</a> 参考文章</h2> <p>https://frxcat.fun/pages/c6a02d/</p></div></div> <!----> <div class="page-edit"><!----> <div class="tags"><a href="/lm_blog_vdoing/tags/?tag=ElasticSearch" title="标签">#ElasticSearch</a></div> <!----></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><a href="/lm_blog_vdoing/pages/6e6e0c/" class="page-nav-centre page-nav-centre-prev"><div class="tooltip">ES入门 - 分片和副本</div></a> <a href="/lm_blog_vdoing/pages/b54e3a/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">ES入门 - java整合</div></a></div> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/lm_blog_vdoing/pages/6e6e0c/" class="prev">ES入门 - 分片和副本</a></span> <span class="next"><a href="/lm_blog_vdoing/pages/b54e3a/">ES入门 - java整合</a>→
      </span></p></div></div></div> <div class="article-list"><div class="article-title"><a href="/lm_blog_vdoing/archives/" class="iconfont icon-bi">最近更新</a></div> <div class="article-wrapper"><dl><dd>01</dd> <dt><a href="/lm_blog_vdoing/pages/6d9622/"><div>
            ES进阶 - 优化配置
            <!----></div></a> <span class="date">02-20</span></dt></dl><dl><dd>02</dd> <dt><a href="/lm_blog_vdoing/pages/7e4dff/"><div>
            ES进阶 - 分片操作原理
            <!----></div></a> <span class="date">02-20</span></dt></dl><dl><dd>03</dd> <dt><a href="/lm_blog_vdoing/pages/b82771/"><div>
            ES进阶 - 并发问题
            <!----></div></a> <span class="date">02-20</span></dt></dl> <dl><dd></dd> <dt><a href="/lm_blog_vdoing/archives/" class="more">更多文章&gt;</a></dt></dl></div></div></main></div> <div class="footer"><div class="icons"><a href="mailto:1512375133@qq.com" title="发邮件" target="_blank" class="iconfont icon-youjian"></a><a href="https://gitee.com/lmgghub/" title="gitee" target="_blank" class="iconfont icon-gitee"></a><a href="https://juejin.cn/user/2295436010326072" title="掘金" target="_blank" class="iconfont icon-juejin"></a></div> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2023
    <span>lm </span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><div></div><div></div><div></div><div id="tcomment"></div><!----></div></div>
    <script src="/lm_blog_vdoing/assets/js/app.fa0e5fdd.js" defer></script><script src="/lm_blog_vdoing/assets/js/2.d9c93b35.js" defer></script><script src="/lm_blog_vdoing/assets/js/22.9937ce9d.js" defer></script><script src="/lm_blog_vdoing/assets/js/5.e0bc0396.js" defer></script><script src="/lm_blog_vdoing/assets/js/13.ee87d1ca.js" defer></script><script src="/lm_blog_vdoing/assets/js/14.9d4d9cf6.js" defer></script><script src="/lm_blog_vdoing/assets/js/9.fc3a629f.js" defer></script><script src="/lm_blog_vdoing/assets/js/10.4c34cde9.js" defer></script>
  </body>
</html>
